package wsepForum.domain.exceptions;

import wsepForum.persistance.exceptions.DataBaseIOException;
import wsepForum.persistance.exceptions.InvalidElementFormatException;

public class SystemFailureException extends Exception {

	private static final long serialVersionUID = 487686944186684593L;
	
	Exception exc;
	
	public SystemFailureException(DataBaseIOException e) {
		this.exc = e;
	}

	public SystemFailureException(String res) {
		super(res);
		this.exc = null;
	}

	public SystemFailureException(InvalidElementFormatException e) {
		this.exc = e;
	}

	@Override
	public String getMessage() {
		if(this.exc == null)
			return super.getMessage();
		else return this.exc.getMessage();
	}
	
	@Override
	public StackTraceElement[] getStackTrace() {
		if(this.exc == null)
			return super.getStackTrace();
		else return this.exc.getStackTrace();
	}

}
